<%!

  Copyright (c) Facebook, Inc. and its affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

%>class <%service:name%>AsyncClient : public <%#service:extends%><% > common/namespace_cpp2%><%service:name%>AsyncClient<%/service:extends%><%^service:extends%>apache::thrift::GeneratedAsyncClient<%/service:extends%> {
 public:
  using <%#service:extends%><% > common/namespace_cpp2%><%service:name%>AsyncClient::<%service:name%>AsyncClient<%/service:extends%><%^service:extends%>apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient<%/service:extends%>;

  char const* getServiceName() const noexcept override {
    return "<%service:name%>";
  }

<%#service:functions%><%#function:returnType%>
<%^function:returns_sink?%>
  virtual void <%function:cpp_name%>(std::unique_ptr<apache::thrift::RequestCallback> callback<%function:comma%><% > service_common/function_param_list_const%>);
  virtual void <%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback<%function:comma%><% > service_common/function_param_list_const%>);
<%/function:returns_sink?%>
 private:
  void <%function:cpp_name%>Impl(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::detail::ac::ClientRequestContext> ctx, <% > types/callback_type%> callback<%function:comma%><% > service_common/function_param_list_const%>);
 public:
<%^function:returns_sink?%><%^type:resolves_to_complex_return?%>
  virtual <% > types/semi_type%> sync_<%function:cpp_name%>(<% > service_common/function_param_list_const%>);
  virtual <% > types/semi_type%> sync_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>);
<%/type:resolves_to_complex_return?%>
<%#type:resolves_to_complex_return?%>
  virtual void sync_<%function:cpp_name%>(<% > types/type%>& _return<%function:comma%><% > service_common/function_param_list_const%>);
  virtual void sync_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions, <% > types/type%>& _return<%function:comma%><% > service_common/function_param_list_const%>);
<%/type:resolves_to_complex_return?%>
<%^type:streamresponse?%>
  virtual folly::Future<<% > types/service_type_semi%>> future_<%function:cpp_name%>(<% > service_common/function_param_list_const%>);
<%/type:streamresponse?%>
  virtual folly::SemiFuture<<% > types/service_type_semi%>> semifuture_<%function:cpp_name%>(<% > service_common/function_param_list_const%>);
<%^type:streamresponse?%>
  virtual folly::Future<<% > types/service_type_semi%>> future_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>);
<%/type:streamresponse?%>
  virtual folly::SemiFuture<<% > types/service_type_semi%>> semifuture_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>);
<%^function:oneway?%>
<%^type:streamresponse?%>
  virtual folly::Future<std::pair<<% > types/service_type_semi%>, std::unique_ptr<apache::thrift::transport::THeader>>> header_future_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>);
<%/type:streamresponse?%>
  virtual folly::SemiFuture<std::pair<<% > types/service_type_semi%>, std::unique_ptr<apache::thrift::transport::THeader>>> header_semifuture_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>);
<%#type:sync_methods_return_try?%>
  FOLLY_NODISCARD [[deprecated("To be replaced by new API soon")]] virtual folly::Try<apache::thrift::RpcResponseComplete<<% > types/semi_type%>>> sync_complete_<%function:cpp_name%>(
      apache::thrift::RpcOptions& rpcOptions<%function:comma%> <% > service_common/function_param_list_const%>);
<%/type:sync_methods_return_try?%>
<%/function:oneway?%>

#if FOLLY_HAS_COROUTINES
  template <int = 0>
  folly::coro::Task<<% > types/service_type_coro%>> co_<%function:cpp_name%>(<% > service_common/function_param_list_const%>) {
    <%#type:void?%>
    co_await semifuture_<%function:cpp_name%>(<% > service_common/param_list%>);
    <%/type:void?%>
    <%^type:void?%>
    co_return co_await semifuture_<%function:cpp_name%>(<% > service_common/param_list%>);
    <%/type:void?%>
  }
  template <int = 0>
  folly::coro::Task<<% > types/service_type_coro%>> co_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>) {
    <%#type:void?%>
    co_await semifuture_<%function:cpp_name%>(rpcOptions<%function:comma%><% > service_common/param_list%>);
    <%/type:void?%>
    <%^type:void?%>
    co_return co_await semifuture_<%function:cpp_name%>(rpcOptions<%function:comma%><% > service_common/param_list%>);
    <%/type:void?%>
  }
#endif // FOLLY_HAS_COROUTINES
<%^type:streamresponse?%>
  virtual void <%function:cpp_name%>(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback<%function:comma%><% > service_common/function_param_list_const%>);
<%/type:streamresponse?%>
<%/function:returns_sink?%>
<%#function:returns_sink?%>
#if FOLLY_HAS_COROUTINES
folly::coro::Task<<% > types/service_type_coro%>> co_<%function:cpp_name%>(<% > service_common/function_param_list_const%>);
folly::coro::Task<<% > types/service_type_coro%>> co_<%function:cpp_name%>(apache::thrift::RpcOptions& rpcOptions<%function:comma%><% > service_common/function_param_list_const%>);
#endif // FOLLY_HAS_COROUTINES
<%/function:returns_sink?%>
<%#type:void?%>
<%^function:oneway?%>
  static folly::exception_wrapper recv_wrapped_<%function:cpp_name%>(::apache::thrift::ClientReceiveState& state);
  static void recv_<%function:cpp_name%>(::apache::thrift::ClientReceiveState& state);
  // Mock friendly virtual instance method
  virtual void recv_instance_<%function:cpp_name%>(::apache::thrift::ClientReceiveState& state);
  virtual folly::exception_wrapper recv_instance_wrapped_<%function:cpp_name%>(::apache::thrift::ClientReceiveState& state);
<%/function:oneway?%>
 private:
  template <typename Protocol_>
  void <%function:cpp_name%>T(Protocol_* prot, apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::detail::ac::ClientRequestContext> ctx, <% > types/callback_type%> callback<%function:comma%><% > service_common/function_param_list_const%>);
 public:
<%/type:void?%>
<%^type:void?%>
<%^function:oneway?%>
  static folly::exception_wrapper recv_wrapped_<%function:cpp_name%>(<% > types/semi_type%>& _return, ::apache::thrift::ClientReceiveState& state);
<%^type:resolves_to_complex_return?%>
  static <% > types/semi_type%> recv_<%function:cpp_name%>(::apache::thrift::ClientReceiveState& state);
  // Mock friendly virtual instance method
  virtual <% > types/semi_type%> recv_instance_<%function:cpp_name%>(::apache::thrift::ClientReceiveState& state);
<%/type:resolves_to_complex_return?%>
<%#type:resolves_to_complex_return?%>
  static void recv_<%function:cpp_name%>(<% > types/type%>& _return, ::apache::thrift::ClientReceiveState& state);
  // Mock friendly virtual instance method
  virtual void recv_instance_<%function:cpp_name%>(<% > types/type%>& _return, ::apache::thrift::ClientReceiveState& state);
<%/type:resolves_to_complex_return?%>
  virtual folly::exception_wrapper recv_instance_wrapped_<%function:cpp_name%>(<% > types/semi_type%>& _return, ::apache::thrift::ClientReceiveState& state);
<%/function:oneway?%>
 private:
  template <typename Protocol_>
  void <%function:cpp_name%>T(Protocol_* prot, apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::detail::ac::ClientRequestContext> ctx, <% > types/callback_type%> callback<%function:comma%><% > service_common/function_param_list_const%>);
<%^function:oneway?%>
 public:
<%/function:oneway?%>
<%/type:void?%>
<%/function:returnType%><%/service:functions%>
};
